import asyncio
import aiohttp
import time

async def fetch(session, url):
    async with session.get(url) as response:
        return await response.text()

async def send_requests(url, num_requests):
    async with aiohttp.ClientSession() as session:
        tasks = [fetch(session, url) for _ in range(num_requests)]
        responses = await asyncio.gather(*tasks)
        return responses

def main(url, num_requests):
    start_time = time.time()
    
    loop = asyncio.get_event_loop()
    responses = loop.run_until_complete(send_requests(url, num_requests))
    
    end_time = time.time()
    elapsed_time = end_time - start_time
    
    print(f"Sent {num_requests} requests to {url}")
    print(f"Total time taken: {elapsed_time:.2f} seconds")
    print(f"Requests per second: {num_requests / elapsed_time:.2f}")

if __name__ == "__main__":
    url = "http://39.106.34.123:12347/"#39.106.34.123:12347
    num_requests = 100000
    main(url, num_requests)